<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0" />

    <meta name="author" content="Rico Berger" />
    <meta
      name="description"
      content="kubenav is the navigator for your Kubernetes clusters right in your pocket."
    />
    <meta
      name="keywords"
      content="kubenav, mobile, app, kubernetes, kubectl, cluster, clusters, navigator, management"
    />
    <meta name="robots" content="index, follow" />

    <meta name="apple-itunes-app" content="app-id=1494512160" />
    <meta name="google-play-app" content="app-id=io.kubenav.kubenav" />

    <meta
      property="og:description"
      content="kubenav is the navigator for your Kubernetes clusters right in your pocket."
    />
    <meta property="og:image" content="https://kubenav.io/img/open-graph.png" />
    <meta
      property="og:image:alt"
      content="kubenav is the navigator for your Kubernetes clusters right in your pocket."
    />
    <meta property="og:title" content="kubenav" />
    <meta property="og:type" content="website" />
    <meta property="og:url" content="https://kubenav.io" />

    <meta name="twitter:card" content="summary_large_image" />
    <meta
      name="twitter:image:src"
      content="https://kubenav.io/img/open-graph.png"
    />
    <meta name="twitter:creator" content="@rico_berger" />
    <meta name="twitter:site" content="@kubenav" />
    <meta name="twitter:app:name:iphone" content="kubenav" />
    <meta name="twitter:app:id:iphone" content="1494512160" />
    <meta name="twitter:app:name:ipad" content="kubenav" />
    <meta name="twitter:app:id:ipad" content="1494512160" />
    <meta name="twitter:app:name:googleplay" content="kubenav" />
    <meta name="twitter:app:id:googleplay" content="io.kubenav.kubenav" />

    <title>kubenav</title>

    <link rel="shortcut icon" type="image/png" href="favicon.png" />

    <link
      href="https://unpkg.com/normalize.css@8.0.1/normalize.css"
      rel="stylesheet"
    />
    <link href="../css/index.css" rel="stylesheet" />
  </head>

  <body>
    <div id="openapp" class="open-app" style="display: none">
      <br /><br /><br /><br /><br />
      <button onClick="copyCodeToClipboard()">Copy Code</button>
      <br /><br />
      <div class="code-state-container">
        <strong>Code:</strong> <span id="code"></span>
        <br />
        <strong>State:</strong> <span id="state"></span>
      </div>
    </div>

    <div id="errorcontainer" class="open-app" style="display: none">
      <br /><br /><br /><br /><br />
      <div class="code-state-container">
        <strong>Error:</strong> <span id="error"></span>
        <br />
        <strong>Error Description:</strong> <span id="errordescription"></span>
      </div>
    </div>

    <script type="text/javascript">
      const params = new URLSearchParams(window.location.search);
      document.getElementById("code").innerText = params.get("code");
      document.getElementById("state").innerText = params.get("state");

      if (params.get("code")) {
        document.getElementById("openapp").style.display = "block";
      } else if (params.get("error")) {
        document.getElementById("error").innerText = params.get("error");
        document.getElementById("errordescription").innerText =
          params.get("error_description");
        document.getElementById("errorcontainer").style.display = "block";
      }
    </script>

    <script type="text/javascript">
      function copyCodeToClipboard() {
        const params = new URLSearchParams(window.location.search);
        navigator.clipboard
          .writeText(params.get("code"))
          .then(() => {
            alert("Code was copied to clipboard");
          })
          .catch(() => {
            alert("Something went wrong");
          });
      }
    </script>
  </body>
</html>
